package com.news.web;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.URLDecoder;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.news.dao.StudentDao;
import org.news.dao.UserDao;
import org.news.dao.impl.StudentDaoImpl;
import org.news.dao.impl.UserDaoImpl;
@WebServlet(name="baidu",urlPatterns="/baidu")
public class BaiduServlet extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		resp.setContentType("text/html;charset=utf-8");
		PrintWriter out = resp.getWriter();
		String keyword = req.getParameter("keyword");
		System.out.println("==原始数据=="+keyword);
		String my=URLDecoder.decode(keyword, "utf-8");
		System.out.println("==解码数据=="+ my);
		/*UserDao dao = new UserDaoImpl();
		List<String> list =dao.findByName(keyword);
		String str = list.toString();
		out.print(str.substring(1, str.length()-1));
		out.close();*/
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doGet(req, resp);
	}
}
